package us.icitap.commandcenter.ui.custom;

import com.vaadin.data.Item;
import com.vaadin.data.Property;
import com.vaadin.data.util.BeanItem;
import com.vaadin.ui.Label;
import com.vaadin.ui.Table;
import com.vaadin.ui.Table.ColumnGenerator;

public class StatusColumnGenerator implements ColumnGenerator{

	@Override
	public Object generateCell(Table source, Object itemId, Object columnId) {
		
		final Item item = source.getItem(itemId);
         final Property prop = item.getItemProperty(columnId);
         
         if(prop.getValue() != null){
        	 Object obj = prop.getValue();
        	 Boolean b =  (Boolean) prop.getValue();
        	 if(b.booleanValue()){
        		 final Label label = new Label("AKTIVE");
        		 return label;
        	 }
        	 else{
        		 final Label label = new Label("JO-AKTIVE");
        		 return label;
        	 }
        	
         }
         else{
        	 return new Label("");
         }
         
     
	}

}
